home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
sort2.zip
/
FINDFLD.FUN
< prev
next >
Wrap
Text File
|
1993-01-04
|
766b
|
21 lines
function findfield(fldnum:integer; s:string):byte;
{ find field returns the first column of the the fldnum "awk" field
-- zero or more blanks followed by one or more non-blanks }
{ Copyright 1988,1989, by J. W. Rider }
{ Externally, "delimset" (set of char) must be created with the valid
field delimiters. Otherwise, white space is assume to be the only valid
delimiter. }
var i,fc:integer; inblank: boolean;
begin fc:=1; i:=1; inblank:=true;
while (i<=length(s)) and (fc<fldnum) do
if delimset=[] then
if s[i] in [^I,' '] then if not inblank then begin
inc(fc); inblank:=true end else inc(i)
else begin inblank:=false; inc(i) end
else begin if s[i] in delimset then inc(fc);
inc(i); end;
findfield:=i; end;